﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Reflection;
using System.Diagnostics;
using System.IO;

namespace BizElements.Generator
{
    public partial class AboutFrm : Form
    {
        public AboutFrm()
        {
            InitializeComponent();
        }

        private void AboutFrm_Load(object sender, EventArgs e)
        {
            Version ver = Assembly.GetExecutingAssembly().GetName().Version;
            this.uiDescription.Text = string.Format(Messages.AboutFrm_DescriptionFormat, ver.Major, ver.Minor, ver.Build);
            this.uiMail.Text = Messages.AboutFrm_SupportMail;
        }

        private void uiMail_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Version ver = Assembly.GetExecutingAssembly().GetName().Version;
            string subject = string.Format("Elements {0}.{1}.{2}", ver.Major, ver.Minor, ver.Build);
            string mailTo = string.Format("mailto:{0}?subject=" + subject, Messages.AboutFrm_SupportMail);
            Process.Start(mailTo);
        }

        private void uiLicense_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            string codeBase = Assembly.GetEntryAssembly().CodeBase;
            string directory = Path.GetDirectoryName(codeBase);
            string licensePath = directory + "\\LICENSE.txt";
            Process.Start(licensePath);
        }

        private void uiClose_Click(object sender, EventArgs e)
        {
            Close();
        }
    }
}
